package com.mtons.mblog.modules.service.impl;

import com.alibaba.fastjson.TypeReference;
import com.mtons.mblog.base.utils.BeanUtils;
import com.mtons.mblog.modules.data.ToolVo;
import com.mtons.mblog.modules.entity.Tool;
import com.mtons.mblog.modules.repository.ToolRepository;
import com.mtons.mblog.modules.service.ToolService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ToolServiceImpl.
 * @author yuzhong
 * @date 2019/2/27 16:42
 */
@Service
public class ToolServiceImpl implements ToolService {
    @Autowired
    private ToolRepository toolRepository;

    @Override
    public List<ToolVo> findToolsAll() {
        List<Tool> tools = toolRepository.findAll();
        List<ToolVo> toolVoList = BeanUtils.copyProperties(tools, new TypeReference<List<ToolVo>>() {
        });
        return toolVoList;
    }


}
